﻿<!DOCTYPE html>

<!--实际操作考核评分--线下考试-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <!-- 行内编辑 css-->
    <style>
        .tb-edit .el-input {
            display: none
        }

        .tb-edit .current-row .el-input {
            display: block
        }

            .tb-edit .current-row .el-input + span {
                display: none
            }

        .xian {
            display: block;
            text-align: center;
        }

        .yin {
            display: none;
            text-align: center;
        }
    </style>
    <!-- 行内编辑 css-->
</head>

<body>
    
<div id="app" v-cloak>   
        <el-form label-position=" right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                 style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool">
                    
<div class="new_title fl"><strong><img src="/static/images/icon1.png" />线下考试评分列表</strong></div>
                    <span>
                        <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
                        </btn>
                        <btn :text="col.btnAdd" linetype="3" @click="add"></btn>
                        <!-- <btn :text="col.btnAdd" linetype="3" @click="OpenInput('tj')"></btn> -->
                        <btn-uploadfile-list url="xxxx" linetype="3"></btn-uploadfile-list>
                        <btn-export-list url="xxxx" :forminline="this.formInline" linetype="3"></btn-export-list>
                        <btn :text="col.btnDownLoadTemplate" imgsrc="/static/images/general.png" linetype="3"
                             @click="btnDownLoadTemplate">
                        </btn>
                        <btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn>
                    </span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item size="mini">
                            <el-input>
                                <template slot="prepend">
                                    {{PracticalOperationalAssessmentScore.Trainingcontent+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.Trainingcontent" slot="suffix"
                                           :placeholder="PracticalOperationalAssessmentScore.Trainingcontent">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in Trainingcontent" :label="item.value" :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.Fullname"
                                      :placeholder="PracticalOperationalAssessmentScore.Fullname" size="mini">
                                <template slot="prepend">
                                    {{PracticalOperationalAssessmentScore.Fullname+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
        </el-form>
        <el-col span="24">
            <el-table ref="table" stripe @current-change="tableHandleCurrentChange" class="tb-edit"
                      :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight" border
                      @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;">
                <el-table-column type="selection" style="
        padding-top: 0px;
        padding-bottom: 0px;
    " align="center" width="55" :reserve-selection="true">
                </el-table-column>
                <!-- 除第一列以外 遍历所有字段 -->
                <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  下同-->
                <el-table-column type="index" :label="col.SequenceNumber" :index="indexMethod" width="50"
                                 show-overflow-tooltip="true"></el-table-column>

                <!-- 行内编辑 html-->
                <el-table-column :label="PracticalOperationalAssessmentScore.Trainingcontent" min-width="400"
                                 show-overflow-tooltip="true">
                    <template scope="scope">
                        <el-input size="mini" v-model="scope.row.Trainingcontent" placeholder="请输入内容" @blur="handblur">
                        </el-input>
                        <span>{{scope.row.Trainingcontent}}</span>
                        <span class="lineMust" v-if="scope.row.Trainingcontent.length<=0">
                            <!-- 必填项添加 -->
                            <img src="/static/images/exclamation.png" alt="">
                        </span>
                    </template>
                </el-table-column>
                <el-table-column :label="PracticalOperationalAssessmentScore.Fullname" width="130">
                    <template scope="scope">
                        <el-input size="mini" v-model="scope.row.Fullname" placeholder="请输入内容" @blur="handblur">
                        </el-input>
                        <span>{{scope.row.Fullname}}</span>
                        <span class="lineMust" v-if="scope.row.Fullname.length<=0">
                            <!-- 必填项添加 -->
                            <img src="/static/images/exclamation.png" alt="">
                        </span>
                    </template>
                </el-table-column>
                <el-table-column :label="PracticalOperationalAssessmentScore.achievement" width="130">
                    <template scope="scope">
                        <el-input size="mini" v-model="scope.row.achievement" placeholder="请输入内容" @blur="handblur">
                        </el-input>
                        <span>{{scope.row.achievement}}</span>
                        <span class="lineMust" v-if="scope.row.achievement.length<=0">
                            <!-- 必填项添加 -->
                            <img src="/static/images/exclamation.png" alt="">
                        </span>
                    </template>
                </el-table-column>


                <el-table-column width="90" prop="update" :label="col.stWork">
                    <template slot-scope="scope">
                        <span class="start xian">
                            <button type="button" class="elst-bt-xg" @click=Edit('xg',scope.row.id,scope.$index)>
                                <i class="el-icon-edit"></i>
                            </button>
                        </span>
                        <span class="end yin">
                            <button type="button" class="elst-bt-xg " @click="Save(scope.$index, scope.row)">
                                <i class="el-icon-circle-check-outline"></i>
                                <!-- 保存 -->
                            </button>
                            <button type="button" class="elst-bt-xg " @click="Back(scope.$index, scope.row)">
                                <i class="el-icon-circle-close-outline"></i>
                                <!-- 撤销 -->
                            </button>
                        </span>
                    </template>
                </el-table-column>
                <!-- 行内编辑 html-->
                <!-- <el-table-column prop="Trainingcontent" :label="PracticalOperationalAssessmentScore.Trainingcontent"
                    min-width="600" show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="Fullname" :label="PracticalOperationalAssessmentScore.Fullname">
                </el-table-column>
                <el-table-column width="53" prop="achievement" :label="PracticalOperationalAssessmentScore.achievement">
                </el-table-column>
                <el-table-column width="53" :label="col.btnUpdate" fixed="right">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg" @click=OpenInput('xg',scope.row.id)>
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column> -->
            </el-table>
            <el-row type="flex" justify="end">

                <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                               :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                               :layout="ListItem.layout" :total="ListItem.total">
                </el-pagination>
            </el-row>
            <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  -->
            <el-dialog title="实际操作考核评分" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%"
                       height="80%" top="10vh" fullscreen="true">
                <iframe ref="iframe" :src="ListItem.InputUrl" style="height:280px;width:100%" frameborder="0"></iframe>
            </el-dialog>
        </el-col>
    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                ListItem: ListItem,
                Form: {
                    id: guidEmpty,
                    PersonnelName: '',
                    Trainingcontent: '',
                    Nameofcertificate: '',
                    Fullname: '',
                    achievement: '',

                },
                Trainingcontent: [],
                isShow: true,
                formInline: {

                    // 遍历所有列 均为字符串即可
                    model: {
                        Name: '', Category: '', Teacher: '', LlearningTime: '', Courseware: '', IsEncrypted: '',
                    },
                    offset: 0,
                    limit: 10
                }
            },
            mounted: function () {
                this.GetPageData(1);
                tablehigh(this);
                this.Trainingcontent = getDicData('66');
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                // 行内编辑 js
                add: function (formName) {
                    if ($('tbody tr').attr("class") == "el-table__row current-row") {
                        showMessage(msg.EditingNotCompleted, 'error');
                    } else {
                        this.Form.Trainingcontent = '';//添加是清空录入数据的，每一项都要有
                        this.Form.Fullname = '';//添加是清空录入数据的，每一项都要有
                        this.Form.achievement = '';//添加是清空录入数据的，每一项都要有
                        $('.el-table__row').removeClass('current-row');
                        $('.el-table__row span.end').removeClass('xian');
                        $('.el-table__row span.end').addClass('yin');
                        $('.el-table__row span.start').removeClass('yin');
                        $('.el-table__row span.start').addClass('xian');
                        this.ListItem.tableData.unshift(this.Form);
                        setTimeout(function () {
                            $('.el-table__row:eq(0)').addClass('current-row');
                            $('.el-table__row:eq(0) span.end').removeClass('yin');
                            $('.el-table__row:eq(0) span.end').addClass('xian');
                            $('.el-table__row:eq(0) span.start').removeClass('xian');
                            $('.el-table__row:eq(0) span.start').addClass('yin');
                        }, 100);
                    }
                },
                //修改
                Edit: function (val, id, index) {
                    $('.el-table__row').removeClass('current-row');
                    $('.el-table__row:eq(' + index + ')').addClass('current-row');
                    $('.el-table__row span.end').removeClass('xian');
                    $('.el-table__row span.end').addClass('yin');
                    $('.el-table__row span.start').removeClass('yin');
                    $('.el-table__row span.start').addClass('xian');
                    $('.el-table__row:eq(' + index + ') span.end').removeClass('yin');
                    $('.el-table__row:eq(' + index + ') span.end').addClass('xian');
                    $('.el-table__row:eq(' + index + ') span.start').removeClass('xian');
                    $('.el-table__row:eq(' + index + ') span.start').addClass('yin');
                },
                // 保存
                Save: function (a, b) {
                    if (!b.Trainingcontent || !b.Fullname || !b.achievement) {
                        showMessage(msg.NoMust, 'error');
                    } else {
                        this.onSubmitForm('form', b);

                        $('.el-table__row').removeClass('current-row');
                        console.log("a", a);
                        console.log("b", b);
                        $('.el-table__row span.end').removeClass('xian');
                        $('.el-table__row span.end').addClass('yin');
                        $('.el-table__row span.start').removeClass('yin');
                        $('.el-table__row span.start').addClass('xian');
                        //初始化数据
                        // this.GetPageData(1);
                        setTimeout(this.GetPageData, 100);
                    }
                },
                Back: function (a, b) {
                    $('.el-table__row').removeClass('current-row');
                    $('.el-table__row span.end').removeClass('xian');
                    $('.el-table__row span.end').addClass('yin');
                    $('.el-table__row span.start').removeClass('yin');
                    $('.el-table__row span.start').addClass('xian');
                    //初始化数据
                    this.GetPageData(1);
                },
                onSubmitForm: function (formName, obj) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        onSubmitForm(this, '/api/PracticalOperationalAssessmentScore/Save', obj);
                        //验证通过
                        // if (valid) {
                        //     onSubmitForm(this, '/api/PracticalOperationalAssessmentScore/Save', obj);
                        // } else {
                        //     //验证失败
                        //     return false;
                        // }
                    });
                },
                handblur: function () {
                    this.$refs.table.setCurrentRow(999);
                    console.log("c", 'c');
                },
                //table选中行handle
                tableHandleCurrentChange: function (currentRow) {
                    this.currSeelctId = currentRow.id;
                    this.currSeelctCell = currentRow;
                },
                // 行内编辑 js





                btnDownLoadTemplate: function () {
                    this.$message({
                        message: '模版下载成功！',
                        type: 'success'
                    });
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                closeDialog: function () { closeDialog(this); },
                //Model 替换成 表名
                onDelete: function () { onDelete(this, '/api/PracticalOperationalAssessmentScore/DeleteMuti'); },

                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Model 替换成 表名
                OpenInput: function (val, id) { DialogShow(this, val, "PracticalOperationalAssessmentScoreInput.html", id); },
                //Model 替换成 表名
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/PracticalOperationalAssessmentScore/GetList') },

                onSubmit: function () { onSubmit(this); },

                handleSizeChange: function (val) { handleSizeChange(this, val); },

                handleCurrentChange: function (val) { handleCurrentChange(this, val); },

                handleNodeClick: function (data) {
                    this.formInline.model.Category = data.id;
                    this.GetPageData(1);
                }
            }
        });
    </script>
</body>

</html>